cmake_minimum_required(VERSION 3.16)

project(ethercat_tcp_split C)
add_compile_options(/W3 /WX-)
add_executable(ethercat_tcp_split cJSON.c main.c tcpserver.c ethercatWindows.c )
if(WIN32)
target_compile_definitions(ethercat_tcp_split PRIVATE _WIN32_WINNT=0x0601)
target_link_libraries(ethercat_tcp_split soem ws2_32)
endif()

set(SOURCE_CONFIG_FILE "${CMAKE_SOURCE_DIR}/test/win32/PDO_TCPCOM2/config.json")
set(TARGET_CONFIG_DIR "${CMAKE_BINARY_DIR}/test/win32/PDO_TCPCOM2/")
file(COPY "${SOURCE_CONFIG_FILE}" DESTINATION "${TARGET_CONFIG_DIR}")
file(COPY "${CMAKE_SOURCE_DIR}/test/win32/PDO_TCPCOM2/run.bat" DESTINATION "${TARGET_CONFIG_DIR}")